<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap Template</title>

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" type="text/css" href="css/default.css">
    <script src="js/bootstrap-treeview.js"></script>

    <style type="text/css">
        .htmleaf-header{margin-bottom: 15px;font-family: "Segoe UI", "Lucida Grande", Helvetica, Arial, "Microsoft YaHei", FreeSans, Arimo, "Droid Sans", "wenquanyi micro hei", "Hiragino Sans GB", "Hiragino Sans GB W3", "FontAwesome", sans-serif;}
        .htmleaf-icon{color: #fff;}
    </style>
</head>
<body>
<div class="htmleaf-container">
    <header class="htmleaf-header bgcolor-12">
        <nav class="navbar navbar-default navbar-fixed-top">
            <!-- We use the fluid option here to avoid overriding the fixed width of a normal container within the narrow content columns. -->
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-6" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#">Brand</a>
                </div>

                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-6">
                    <ul class="nav navbar-nav">
                        <li class="active"><a href="#">Home</a></li>
                        <li><a href="#">Link</a></li>
                        <li><a href="#">Link</a></li>
                    </ul>
                </div><!-- /.navbar-collapse -->
            </div>
        </nav>
    </header>
    <div class="row">
        <div class="col-sm-3" style="padding: 0px">
            <h2>Default</h2>
            <div id="treeview1" class=""></div>
            <div id="treeview-checkable" class=""></div>
        </div>
        <div class="col-sm-9" id="mianDiv" style="background: pink;padding: 0px">
            <iframe id="mainFrame" width="100%" style="height: 100%"></iframe>
        </div>
    </div>
</div>

<script type="text/javascript">

    $(function() {

        $("#mianDiv").css("height",(window.innerHeight-100)+"px");

        $.post("/list",function (defaultData) {
            console.log(defaultData);
            $('#treeview1').treeview({
                data: defaultData
            });
            $('#treeview1').on("nodeSelected",function (event,data) {
                // console.log(data.href);
                $("#mainFrame").attr("src",data.href);
            });
        },"json");


    });
</script>
</body>
</html>